package cn.wolfcode.service.impl;

import cn.wolfcode.entity.Banner;
import cn.wolfcode.mapper.BannerMapper;
import cn.wolfcode.service.IBannerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author c1eye
 * @since 2022-11-03
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements IBannerService {

    @Override
    public List<Banner> queryByType(int i) {

        QueryWrapper<Banner> wrapper = new QueryWrapper<>();
        wrapper.eq("type", i);
        wrapper.eq("state", 0);
        wrapper.last("limit 5");
        return list(wrapper);
    }
}
